<?php

namespace App\Admin\Controllers;

use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Widgets\Card;
use App\Admin\Metrics\Charts\OrderLIne;
use App\Admin\Metrics\Charts\VisitLIne;
use App\Admin\Metrics\Charts\UserAction;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('统计面板')
            // ->description('Description...')
            ->body(function (Row $row) {
                $row->column(6, function (Column $column) {
                    $column->row(new Examples\Tickets());
                    $column->row(function (Row $row) {
                        $row->column(5, new Examples\NewUsers());
                        $row->column(7, new Examples\NewOrders());
                    });
                });

                $row->column(6, function (Column $column) {
                    $column->row(Card::make('访客浏览量走势图', VisitLIne::make()));
                    
                });
                $row->column(6, function (Column $column) {
                    
                    $column->row(new Examples\OrderMoney());
                    $column->row(new Examples\WithDraws());
                });

                $row->column(6, function (Column $column) {
                    $column->row(Card::make('订单金额走势图', OrderLIne::make()));
                    
                });
                $row->column(12, function (Column $column) {
                    $column->row(Card::make('24 小时用户支付行为', UserAction::make()));
                    
                });
                $row->column(6, function (Column $column) {
                    
                    $column->row("<a href='http://pic.tg7q1u.cn/' target='blank'>视频库更新后，点此同步更新图片加密文件(先要修改视频服务器文件夹权限)</a>");
                });
            });
    }
}
